package com.yunhui.service.mq;


import com.yunhui.util.SmsUtil;

import org.springframework.stereotype.Service;



import javax.annotation.Resource;


@Service
//@RabbitListener(queues="queuemessage")
public class MQMessageService {



   /* *//**
     * 使用消息列队发送短信功能
     * @param phone
     */

   //短信工具类
   @Resource
    private SmsUtil smsUtil;
 /*   @RabbitHandler
    public void duaxin(String phone, Integer code,Channel channel, Message message) {
        try {
            //int i = 1/0;
            //这里写你的消费逻辑，如果出错，会被catch
            smsUtil.sendSms(phone,code);
        } catch (Exception e) {
            //这段代码表示，这次消息，我已经接受并消费掉了，不会再重复发送消费
            try {
                channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }

    }*/
}
